home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 37
/
037.d81
/
total control
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
3KB
|
82 lines
10 gosub60100:clr:goto100
19 :
20 : ************************
21 : * *
22 : * input subroutine is *
25 : * lines 40-59 *
26 : * *
27 : ************************
29 :
40 poke198,0:print"[[166]";:forx=1tole:print" ";:next:print"]":print"[145]";
41 c$="":fora=1tole+1
42 geta$:ifa$=""then42
44 ifa$=chr$(13)then59
46 ifa$=chr$(20)anda>1thenprint"[157][157] [157][157][166]";:a=a-1:c$=left$(b$,a-1):goto42
48 ifa=le+1then42
50 if(nu)thenifa$>="0"anda$<="9"then58
51 if(nu)thenifa$="."ora$="-"then58
52 if(al)and((a$>=" "anda$<="/")or(a$>=":"anda$<="z"))then58
54 if(al)thenif(a$>="[193]"anda$<="[218]")then58
56 goto42
58 print"[157]"a$;:poke212,.:print"[166]";:c$=c$+a$:next
59 print"[157] ":return
62 :
63 : * demo for subroutine *
64 :
100 poke53280,.:poke53281,.:print"[147] [158][212]otal [195]ontrol"
110 print" [194]y [199]ary [214]. [198]ields"
120 print" [154][212]otal [195]ontrol lets you choose the"
130 print"maximum number of characters to be"
140 print"entered, and whether or not you want to"
150 print"accept numbers, letters, or both."
160 print"[198]irst, you must set [158][204][197] [154]equal to the"
170 print"maximum number of characters you want"
180 print"the routine to accept. [212]hen, if you"
190 print"want the user to be able to enter"
200 print"numbers, set [158][206][213] [154]equal to 1; and, if you"
210 print"want the user to be able to enter"
220 print"letters, set [158][193][204] [154]equal to 1. [212]hen all"
230 print"you need to do is [158][199][207][211][213][194] 40[154]."
250 print"[212]he following is an example of what"
260 print"the [194][193][211][201][195] code and the output would"
270 print"look like:"
280 print" [204][197]=20:[206][213]=0:[193][204]=1:[199][207][211][213][194]40"
285 print"[159][217]ou can only enter letters."
290 le=20:nu=.:al=1:gosub40
300 print"[145][145][145][145][145]";:fora=1to5:print" ":next
310 print"[145][145][145][145][145][145]"
320 print" [204][197]=13:[206][213]=1:[193][204]=0:[199][207][211][213][194]40"
325 print"[159][217]ou can only enter numbers."
330 le=13:nu=1:al=0:gosub40
340 print"[145][145][145][145][145]";:fora=1to5:print" ":next
350 print"[145][145][145][145][145][145]"
360 print" [204][197]=34:[206][213]=1:[193][204]=1:[199][207][211][213][194]40"
370 print"[159][217]ou can numbers or letters."
380 le=34:nu=1:al=1:gosub40
390 print"[145][145][145][145][145]";:fora=1to5:print" ":next
400 print"[145][145][145][145][145][145]"
410 print" [208]ress [[211][208][193][195][197]] to see demo again"
420 print" or [[210][197][212][213][210][206]] to return to [204][207][193][196][211][212][193][210]":poke198,.
430 a=peek(203):ifa<>1anda<>60then430
440 ifa=60then100
450 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
460 ifer<>63thenend
470 load"hello connect",8
60100 poke53280,10:poke53281,10
60110 print"[147][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]";
60120 fora=1to23:print"[221]"spc(38)"[221]";:next
60130 print"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][157][148][192]"
60135 fora=217to242:pokea,peek(a)or128:next
60140 print" [204][207][193][196][211][212][193][210] [208]resents:"
60150 print" [158] "
60160 print" [158] [212]otal [195]ontrol "
60170 print" [158] "
60180 print" [158] [194]y [199]ary [214]. [198]ields "
60190 print" [158] "
60200 print" [158] ([195])opyright 1987 "
60210 print" [158] "
60220 print" "
60230 print" [208]ress [211][208][193][195][197] to continue.":poke198,.
60240 ifpeek(203)<>60then60240
60250 return